// using GGameFramework;
using GGameFramework.Event;
using TMPro;
using UnityEngine;
using GGameFramework.Runtime;

namespace BangBangHell
{
    public class ScoureUI : MonoBehaviour//, IListener<int>,IListener<float>,IEventListener
    {
        public TextMeshProUGUI ScoreText;
    
        public GameEvent<int> ScoreIntEvent;
        
        public GameEvent<float> ScoreFloatEvent;
        
        private int _score;
        
        private float _score_F;
        private void Start()
        {
            // ScoreIntEvent.Register(this);
            // ScoreFloatEvent.Register(this);
            // Manager.Event.Register<Event_Test>(this,OnTypeEventRaised);
            
            Debug.Log("SoureUi注册事件");
            GameEntry.Event.Register<Event_Test>(OnTypeEventRaised);
        }
        
        void UpdateScoureUI(int score)
        {
            _score += score;
            ScoreText.text = _score.ToString();
            Debug.Log(_score);
        }
        void UpdateScoureUI(float score)
        {
            _score_F += score;
            ScoreText.text = _score_F.ToString();
            Debug.Log(_score_F);
        }
        
        public void OnEventRaised(int arg)
        {
            UpdateScoureUI(arg);
        }
        
        public void OnEventRaised(float arg)
        {
            UpdateScoureUI(arg);
        }

        public void OnTypeEventRaised(Event_Test arg)
        {
            UpdateScoureUI(arg.Source);
        }
        
        
    }

}
